package org.bleep.physics;

public class Point
{
	private float x;
	private float y;
	
	public Point()
	{
		this.x = 0f;
		this.y = 0f;
	}
	
	public Point(float x, float y)
	{
		this.x = x;
		this.y = y;
	}
	
	public Point(int x, int y)
	{
		this.x = (float)x;
		this.y = (float)y;
	}
	
	public float getX()
	{
		return x;
	}
	
	public float getY()
	{
		return y;
	}
	
	public void translate(float x, float y)
	{
		this.x += x;
		this.y += y;
	}
	
	public float distance(Point b)
	{
		float xDistance = b.getX() - x;
		float yDistance = b.getY() - y;
		return (float)Math.sqrt((double)(xDistance * xDistance + yDistance * yDistance));
	}
	
	public Point snap()
	{
		return new Point((int)(x + 0.5f), (int)(y + 0.5f));
	}
}